﻿namespace Socket.Core
{
    using System;
    using System.Collections;
    using System.Runtime.CompilerServices;

    public static class BitHelper
    {
        public static void GetBytes(this IList buffer, int value, int offset)
        {
            buffer[offset] = (byte) value;
            buffer[offset + 1] = (byte) (value >> 8);
            buffer[offset + 2] = (byte) (value >> 0x10);
            buffer[offset + 3] = (byte) (value >> 0x18);
        }

        public static void GetBytes(this IList buffer, ushort value, int offset)
        {
            buffer[offset] = (byte) value;
            buffer[offset + 1] = (byte) (value >> 8);
        }
    }
}

